package hlhj.fhp.checkpoint.atys

import android.text.InputFilter
import hlhj.fhp.checkpoint.BaseAty
import hlhj.fhp.checkpoint.R
import hlhj.fhp.checkpoint.iview.ReportView
import hlhj.fhp.checkpoint.javaBean.MyBaseBean
import hlhj.fhp.checkpoint.presenter.ReportPresenter
import hlhj.fhp.checkpoint.utils.ToastUtils
import kotlinx.android.synthetic.main.aty_report.*
import kotlinx.android.synthetic.main.lo_pub_head.*

/**
 * Created by Never Fear   on 2018\11\13 0013.
Never More....
 */
class ReportAty :BaseAty<ReportView,ReportPresenter>(), ReportView {
    override fun addReportResp(myBaseBean: MyBaseBean) {
        ToastUtils.toast("反馈成功",this)
        setResult(-1)
        finish()
    }

    override fun initView() {
        tvTittle.text="意见反馈"
        etContent.filters= arrayOf<InputFilter>(InputFilter.LengthFilter(400))
    }

    override fun logicStart() {

    }

    override fun setListener() {
        btCommit.setOnClickListener {
            if (etContent.text.isEmpty()){
                ToastUtils.toast("内容不能为空",this@ReportAty)
                return@setOnClickListener
            }
            presenter?.addReport(this,etContent.text.toString())
        }
    }

    override fun bindView(): ReportView {
        return this
    }

    override fun createPresenter(): ReportPresenter {
        return ReportPresenter()
    }

    override val contentId: Int= R.layout.aty_report
}